package com.yl.chainStore.common

import com.yl.chainStore.util.GenerateNum

class NumberGenerateNum {

	companion object {
		private val  companyHistoryNumMap: MutableMap<Long, GenerateNum> = mutableMapOf()

		/**
		 * 仓库锁
		 * companyId_deptId
		 */
		fun getGenerateNum(companyId:Long):GenerateNum{
			val get = companyHistoryNumMap[companyId]
			if(get == null){
				val any = GenerateNum()
				companyHistoryNumMap[companyId] = any
				return any
			}
			return get
		}

		fun getCompanyHistoryNum(companyId:Long):String{
			return getGenerateNum(companyId).generateOrder("S")
		}
	}
}
